Repository navigation
fix(tables): an escaped pipe stays inside its cell - #44
Merged
Merged
Conversation
parseTableRow split on every `|`, so `\|` (GFM's way to put a pipe in a cell) started a new column: `` `--part 1\|2` `` became two cells, the row gained a column and the code span broke apart. Rows are now scanned character by character: only an unescaped `|` separates cells, and `\|` becomes a literal `|` in the cell, inside code spans too, as GFM specifies. `\\|` is an escaped backslash followed by a real separator. Other escapes are left for the inline renderer as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Merged
Owner
|
Shipped in v1.14.0: GitHub download and Homebrew ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In a table cell, an escaped pipe (
\|) is now a literal|, the way GitHub renders it. Before this change it started a new column.`--part 1|2`--part 1|2(code)a | ba | bWhy
GFM documents
\|as the way to put a pipe into a table cell, including inside inline code. It is common in tables of CLI options such as--part 1|2. QuickMD split such a row into one cell too many: the rest of the row moved one column to the right, and the backticks ended up in different cells.How
parseTableRowscans the row character by character instead of callingcomponents(separatedBy: "|"). Only an unescaped|separates cells.\|becomes|in the cell text, inside code spans too (GFM).\\|is an escaped backslash followed by a real separator. Other escapes stay in the text for the inline renderer, as before.Testing
ParserTests.testEscapedPipeStaysInsideItsCell: escaped pipe inside a code span and in plain text,\\|, and an escaped pipe at the end of a cell.xcodebuild … test: all 757 tests pass. The Release build and the-DAPPSTOREbuild both succeed.1|2.[Unreleased].🤖 Generated with Claude Code